<?php
session_start();
?>
<?php require_once('Conection_DataBase.php') ?>
<?php
//mysql_select_db($database_jssue, $jssue);
$Querry_recordSet = "select cllg_menu.TITTLE,cllg_menu.ID from cllg_menu where cllg_menu.ORDEN = 0 group by cllg_menu.id";
$recordset = mysql_query($Querry_recordSet, $jssue) or die(mysql_error());
?>
<ul class="nav nav-tabs"><li class="active" style="font-weight: bolder"><a>Mantenimiento Sistema</a></li></ul>
<table width="70%" height="101" border="0" align="center" cellspacing="0" class="">
    <thead>

        <tr >
            <th width="292" height="3" align="left" valign="bottom"><legend>T&iacute;tulo Menu</legend>
    <th width="282" align="center"><legend>Acciones</legend></tr>
    </thead>
    <?php
    while ($prueba = mysql_fetch_assoc($recordset)) {
        $id = $prueba["ID"];
        $idde = $id . "_" . "1";
        ?>
        <tr>
            <td height="20"><strong><legend><?PHP echo $prueba["TITTLE"]; ?></legend></strong>
            <td align="center" valign="middle">
                <a href="Menu1.php?delete=<?PHP echo $even = $id; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                    <img  src="./images/icon_delete.gif" title="ELIMINAR" alt="ELIMINAR" name="button2" id="button2" /></a>  &nbsp;&nbsp;
                <a href="Menu1.php?IngreHijo=<?PHP echo $even = $idde; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                    <img type="image" src="./images/Untitled-2.gif" title="INGRESAR" alt="INGRESAR" name="button22" id="button22" /></a>&nbsp;&nbsp;<a href="Menu1.php?ModifiPadre=<?PHP echo $even = $idde; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                    <img type="image" src="./images/icon_edit.gif" title="MODIFICAR" alt="MODIFICAR" name="button23" id="button23" />
                </a></td>
        </tr>

        <tr>
            <td height="27" colspan="2"><?PHP if (!$id == "") { ?><table width="100%" border="0" cellspacing="0">
                        <?PHP
                        $Querry_recordSetM = "select cllg_menu.URL,cllg_menu.TITTLE,cllg_menu.ID,cllg_menu.MENU_PARENT from cllg_menu where cllg_menu.ORDEN = '$id' and cllg_menu.MENU_PARENT <= 2 group by cllg_menu.id";
                        $recordsetM = mysql_query($Querry_recordSetM, $jssue) or die(mysql_error());
                        ?>
                        <?php
                        while ($pruebaM = mysql_fetch_assoc($recordsetM)) {
                            $idHijo = $pruebaM["ID"];
                            $iddeHijo = $idHijo . "_" . "2";
                            if ($pruebaM["MENU_PARENT"] >= 2) {
                                $Subsuba = "SI";
                            } else {
                                $Subsuba = "NO";
                            }
                            ?>
                            <tr>
                                <td width="37" rowspan="2">&nbsp;</td>
                                <td width="197"><?PHP echo $pruebaM["TITTLE"]; ?></td>
                                <td width="190"><?PHP echo $pruebaM["URL"]; ?></td>
                                <td width="144">
                                    <a href="Menu1.php?delete=<?PHP echo $even = $idHijo; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                                        <img type="image" src="./images/icon_delete.gif" title="ELIMINAR" alt="ELIMINAR" name="button2" id="button2" /></a>  &nbsp;&nbsp;
                                    <a href="Menu1.php?IngreSubHijo=<?PHP echo $even = $iddeHijo; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                                        <img type="image" src="./images/Untitled-2.gif" title="INGRESAR" alt="INGRESAR" name="button2" id="button2"/></a>&nbsp;&nbsp;<a href="Menu1.php?ModifiHijo=<?PHP echo $even = $iddeHijo; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                                        <img type="image" src="./images/icon_edit.gif" title="MODIFICAR" alt="MODIFICAR" name="button" id="button" /></a> </td>

                            </tr>
                            <tr>
                                <td colspan="3"><?PHP if ($Subsuba == "SI") { ?><table width="100%" border="0" cellspacing="0">
                                            <?PHP
                                            $idmenu = $pruebaM["ID"];
                                            $Querry_recordSetSUb = "select * from cllg_menu where ORDEN = '$idmenu'";
                                            $recordsetSUb = mysql_query($Querry_recordSetSUb, $jssue) or die(mysql_error());
                                            ?>
                                            <?PHP while ($pruebaSUb = mysql_fetch_assoc($recordsetSUb)) { ?>
                                                <?PHP $idSUB = $pruebaSUb["ID"]; ?>
                                                <?php $idSUB = $idSUB . "_" . "3" ?>
                                                <tr>
                                                    <td width="59">&nbsp;</td>
                                                    <td width="135"><?PHP echo $pruebaSUb["TITTLE"]; ?></td>
                                                    <td width="20">&nbsp;</td>
                                                    <td width="250"><?PHP echo $pruebaSUb["URL"]; ?></td>
                                                    <td width="145"><a href="Menu1.php?delete=<?PHP echo $even = $idSUB; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                                                            <img type="image" src="./images/icon_delete.gif" title="ELIMINAR" alt="ELIMINAR" name="button2" id="button2" /></a>&nbsp;&nbsp;
                                                        <a href="Menu1.php?ModifiHijo=<?PHP echo $even = $idSUB; ?><?PHP $_SESSION["Titulo"] = "Casos"; ?>">
                                                            <img type="image" src="./images/icon_edit.gif" title="MODIFICAR" alt="MODIFICAR" name="button2" id="button2" /></a></td>
                                                </tr><?PHP } ?>
                                        </table><?PHP } ?></td>
                            </tr>
                        <?PHP } ?>
                    </table>
            <?PHP } ?>             </tr>

    <?PHP } ?>

    <tr>
        <td height="9" colspan="2" align="center"><span class="style4"><a href="IngresoPadre.php"><img src="images/Untitled-2.gif" name="Image3" alt="AGREGAR NUEVO"  border="0" id="Image3" 	/></a></span></td>
    </tr>
</table>
